const Router = require("koa-router");
const typeServer = require("../server/typeServer")
const filmServer = require("../server/filmServer")

const router = new Router({
    prefix: "/api"
});

router.get("/types", async function (ctx) {
    // asdasdas
    ctx.body = {
        state:true,
        msg:"获取列表分类成功",
        data:typeServer.selectTypes()
    }
});
router.get("/films", async function (ctx) {
    let tid = ctx.query.tid;
    let pageNum = ctx.query.pageNum;
    let pageSize = ctx.query.pageSize;

    ctx.body = {
        state:true,
        msg:"获取列表分类成功",
        data:filmServer.selectFilms(tid,pageNum,pageSize)
    }
});


module.exports = router;